import request from '@/request'

export const getRecommendList = () => {
    return request({
        url: '/recommends',
        method: 'GET'
    })
}

// 根据服务的 ID 查询服务的详情
export const getServiceDetailById = (shopId: number) => {
    return request({
        url: `/service_web/${shopId}`,
        method: 'GET'
    })
}

// 根据用户的 ID 查询订单信息
export const getOrderByUserId = (params: Record<string, any>) => {
    return request({
        url: '/order_web/get_order',
        method: 'GET',
        params: params
    })
}

export const getCartByUserId = (params: Record<string, any>) => {
    return request({
        url: '/cart_web/get_cart',
        method: 'GET',
        params: params
    })
}

// 更新用户信息
export const updateUserDetail = (params: Record<string, any>) => {
    return request({
        url: '/user_web/update_user',
        method: 'POST',
        params
    })
}

export const userBecomeShop = (params: { shopName: string }) => {
    return request({
        url: '/user_web/became_shop',
        method: 'POST',
        params
    })
}

export const getCarInfo = () => {
    return request({
        url: '/user_web/get_car_info',
        method: 'GET'
    })
}

export const addCarPhoto = (carId: any, params: any) => {
    return request({
        url: `/car_web/add_photo_car/${carId}`,
        method: 'POST',
        params
    })
}

export const addCarInfo = (params: Record<string, any>) => {
    return request({
        url: `/car_web/add_car`,
        method: 'POST',
        params
    })
}

export const addCartToUser = (params: Record<string, any>) => {
    return request({
        url: '/cart_web/add_cart',
        method: 'POST',
        params
    })
}

// 新增店铺
export const add_shop = (params: Record<string, any>) => {
    return request({
        url: '/user_web/add_shop',
        method: 'POST',
        params
    })
}


// 根据 ID 查询车辆信息
export const getCarById = (carId: number) => {
    return request({
        url: `/car_web/${carId}`,
        method: 'GET',
    })
}

// 根据图片ID删除图片
export const removeCarPhoto = ( photoId: number) => {
    return request({
        url: `/car_web/remove_car_photo/${photoId}`,
        method: 'POST',
    })
}